import React, { Component } from 'react';
import {withRouter} from "react-router-dom"
import Header from "../components/all/header";
import Footer from "../components/all/footer";
import { Menu } from 'antd';
import { UserOutlined ,HighlightOutlined ,SnippetsOutlined ,HomeOutlined ,ShoppingOutlined ,CloseCircleOutlined ,BranchesOutlined} from '@ant-design/icons';
import {Redirect, Route ,Switch} from "react-router-dom";
import allgoods from "./admin_er/all_goods";
import addgoods from "./admin_er/add_goods";
// import noPay from "./admin_er/no_pay";
// import noShouHuo from "./admin_er/no_shouhuo";

import {Sadmin} from "../styled/admin"
import confirm from 'antd/lib/modal/confirm';
import { message, Button, Space } from 'antd';
const { SubMenu } = Menu;
class Myself extends Component {
    constructor(props){
        super(props)
    }
    //二级路由跳转
    jumpRouter(router){
        this.props.history.push(router)
    }
   
    // // 是否是管理员？
    // isyesAdmin(){
    //     if(sessionStorage.getItem("userIdcard") == 1){
    //         return (
    //             <Menu.Item key="6" icon={<SnippetsOutlined />}  onClick={this.jumpRouter.bind(this,"/admin")}>管理平台</Menu.Item>
    //         )
    //     }
    // }
    render() {
        return (
            <div>
                <Header></Header>
                <Sadmin>
                <div className="left">
                    <Menu onClick={this.handleClick} style={{ width: 256 }} defaultSelectedKeys={['1']} defaultOpenKeys={['sub1']} mode="inline">
                        <SubMenu key="sub1" icon={<UserOutlined />} title="管理中心">
                            <Menu.ItemGroup key="g1" title="管理">
                                <Menu.Item key="1" icon={<HighlightOutlined />}  onClick={this.jumpRouter.bind(this,"/admin/allgoods")}>所有商品</Menu.Item>
                                <Menu.Item key="2" icon={<SnippetsOutlined />}  onClick={this.jumpRouter.bind(this,"/admin/addgoods")}>上传商品 </Menu.Item>
                            </Menu.ItemGroup>
                      
                        </SubMenu>
                    </Menu>
                </div>
                <div className="right">
                    <Switch>
                        <Route path="/admin/allgoods" component={allgoods} />
                        <Route path="/admin/addgoods" component={addgoods} />
                        {/* <Route path="/admin/noPay" component={noPay} />
                        <Route path="/admin/noShouHuo" component={noShouHuo} /> */}
                        <Redirect from="/admin" to="/admin/allgoods" />
                    </Switch>
                </div>
                </Sadmin>
                <Footer></Footer>
            </div>
        )
    }
}
export default withRouter(Myself)